﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities; 

namespace BookInventory
{
     /*****************************************************/ 
    // This custom activity creates a BookInfoList class 
    // which is a collection of BookInfo classes.  It uses 
    // the input parameters (BookSearch class) to "lookup" 
    // the matching items. The BookInfoList class is  
    // returned in the output parameter.   
    /*****************************************************/ 
    public sealed class PerformLookup : CodeActivity 
    { 
        public InArgument<String>Title { get; set; }
        public InArgument<String> Author { get; set; }
        public InArgument<String> ISBN { get; set; } 
        public OutArgument<BookInfo[]> BookList { get; set; } 
 
        protected override void Execute(CodeActivityContext context) 
        {
            string author = Author.Get(context);
            string title = Title.Get(context);
            string isbn = ISBN.Get(context); 
 
            BookInfo[] l = new BookInfo[4]; 
 
            l[0] = new BookInfo(title, author, isbn, "Available"); 
            l[1] = new BookInfo(title, author, isbn, "CheckedOut"); 
            l[2] = new BookInfo(title, author, isbn, "Missing"); 
            l[3] = new BookInfo(title, author, isbn, "Available"); 
            BookList.Set(context, l); 
        } 
    } 
}